<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
// See detail in http://wkb.ug/8145
test(() => assert_selection(
    '<div contenteditable="plaintext-only">|</div>',
    'insertHTML <p style="margin: 0; font: 12px Helvetica">foo <b>bar</b> baz</p>',
    '<div contenteditable="plaintext-only">foo bar baz|</div>'),
    'insert HTML as plain text.');

// Regression by 8145 fix
test(() => assert_selection(
    '<div contenteditable>foo<br>|bar<br>baz</div>',
    'insertHTML <div>FOO</div>BAR',
    '<div contenteditable>foo<br><div>FOO</div>BAR|bar<br>baz</div>'),
    'insert HTML at start of paragraph.');

// Regression by 8145 fix
test(() => assert_selection(
    '<div contenteditable><div>f|oo</div></div>',
    'insertHTML <div>bar</div>baz<br class="Apple-interchange-newline">',
    '<div contenteditable><div>fbar</div>baz<div>|oo</div></div>'),
    'interchange-newline is not inserted before DIV');
</script>
